
*---------------------------------------*			
* 		 MODELS WITH CONTROLS 			*			
*---------------------------------------*

clear all	
cd "${data}"	
use "data1.dta", clear 


gen age = IMD2001_1 if IMD2001_1<121   // continous

 * SEX
 
gen female =.
replace female = 1 if IMD2002==2
replace female = 0 if IMD2002==1

 *EDUCATION
 
gen education = IMD2003 
replace education = . if education > 4 
label define education 0"no education" 1"primary or lower secondary" 2"higher secondary" 3"post-secondary" 4"university" 
label values education education



* LABOUR STATUS

gen labourstatus = .
replace labourstatus = 1 if IMD2014==00 | IMD2014==01 | IMD2014==02 | IMD2014==03 // 00=employed, 01=employed
replace labourstatus = 2 if IMD2014==05 // unemployed 
replace labourstatus = 4 if IMD2014==07 // retired
replace labourstatus = 3 if IMD2014==06 // student 
replace labourstatus = 5 if IMD2014==09 // permenantly disabled 
replace labourstatus = 6 if IMD2014==04 | IMD2014==08 | IMD2014==10 | IMD2014==11 | IMD2014==12 // 4=helping a family member, 8=homemaker, home duties, 10=others, not in labour market, 11=on temporary job leave, 12= civil/military service 
label define labourstatus 1"employed" 2"unemployed" 3"student" 4"retired" 5"permanently disabled" 6"other"
label values labourstatus labourstatus

	* URBAN RURAL 

replace IMD2007 = . if IMD2007>4
rename IMD2007 ruralurban

label define ruralurban 1"village" 2"small town" 3"suburbs of large city" 4"large city"
label values ruralurban ruralurban


	*INCOME 

gen income = IMD2006
replace income = . if IMD2006>5

label define income 1"lowest quantile" 2"second quantile" 3"third quantile" 4"fourth quantile" 5"highest quantile"
label values income income



eststo CSES_controls: mixed c.IMD3007_ c.daysafter##c.IMD5012_ age i.education i.labourstatus i.income i.ruralurban || country_: || election_:  || respondent: IMD5012_ 

cd "${tables}"	
esttab CSES_controls using tableJ1.tex, b(3) se(3) nogap transform(ln*: exp(2*@) 2*exp(2*@)) label mlabels ("Model 1") replace

